import java.util.ArrayList;

public  class Teste2 {

	public static void main(String[] args) {
		
		
	}
}
	

class A {
	
	public synchronized void imprimir(){
		for (int i=0;i<10;i++){
			
			System.out.println(i);
			try{
				Thread.sleep(1000);
				//this.wait();	
			}
			catch(Exception e){
				System.out.println("erro");
			}
			
		}
	}
	
	public void imprimir2(){
		synchronized(this){
		for (int i=0;i<10;i++){
			
			System.out.println(i);
			try{
				Thread.sleep(300);
				//this.wait();	
			}
			catch(Exception e){
				System.out.println("erro");
			}
			
		}
		}
	}
	
}


